SystemModeler Applied

Three talks

SystemModeler in Education

Modeling the Flap System in the Cessna

Connectivity and Deployment

SystemModeler in Education

Johan Rhodin

Wolfram Research

6 continents with SystemModeler academic site licenses

2012: SystemModeler 3.0 released

2014: SystemModeler 4.0 released & SystemModeler Library Store

2014 October: ModelPlug library released, updated PlanarMechanics library released (both excellent candidates to use for teaching!)

Libraries are important because they add new domain knowledge without new release of SystemModeler

Libraries can be developed by various departments and released for others to use

Getting started

We want to make it as easy as possible to get started with SystemModeler. For all users, not only in academia.

Book & Improved documentation

Create components from Mathematica

Real-time link

Modelica by Example book & Documentation

Embedded in SystemModeler 4

Great way to learn Modelica, helpful in multiple domains

Search enabled: documentation, book, component libraries

Components from Equations

Traditionally you create components by drag-and-drop or writing Modelica code:

WSMModelData["PlanarMechanicsStandard.Examples.TwoTrackWithDifferentialGear"]

({{"Edit"}, {model ActuatedRevolute "A revolute joint that can be actuated"}, {  Interfaces.Frame_a frame_a;}, {  Interfaces.Frame_b frame_b;}, {  parameter Boolean initialize = false "Initialize angular Position and angular Velocity";}, {  parameter SI.Angle phi_start = 0 "Initial angular position";}, {  parameter SI.AngularVelocity w_start = 0 "Initial angular velocity";}, {  SI.Angle phi(stateSelect = if enforceStates then StateSelect.always else StateSelect.prefer) "Angular position";}, {  SI.AngularVelocity w(stateSelect = if enforceStates then StateSelect.always else StateSelect.prefer) "Angular velocity";}, {  SI.AngularAcceleration z "Angular acceleration";}, {  SI.Torque t "Torque";}, {  parameter Boolean animate = true "Enable Animation";}, {  parameter Boolean enforceStates = false "Enforce the state of the prismatic joint to become the state of the total system";}, {  MB.Visualizers.Advanced.Shape cylinder(shapeType = "cylinder", color = {255, 0, 0}, specularCoefficient = 0.5, length = 0.2, width = 0.1, height = 0.1, lengthDirection = {0, 0, 1}, widthDirection = {1, 0, 0}, r_shape = {0, 0, -0.05}, r = {frame_a.x, frame_a.y, 0}, R = MB.Frames.nullRotation()) if animate;}, {  Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a;}, {initial equation}, {  if initialize then}, {    phi = phi_start;}, {    w = w_start;}, {  end if;}, {equation}, {  //Differential Equations}, {  phi = flange_a.phi;}, {  w = der(phi);}, {  z = der(w);}, {  //Acturation Torque}, {  t = flange_a.tau;}, {  //Rigidly connect positions}, {  frame_a.x = frame_b.x;}, {  frame_a.y = frame_b.y;}, {  frame_a.phi + phi = frame_b.phi;}, {  //Balance forces}, {  frame_a.fx + frame_b.fx = 0;}, {  frame_a.fy + frame_b.fy = 0;}, {  frame_a.t + frame_b.t = 0;}, {  frame_a.t = t;}, {end ActuatedRevolute;}})

SystemModeler 4

eqs={y[t]==u[t]*Sin[t]+1};

Create a block.

WSMCreateModel["AddBlock"∈"Blocks.Interfaces.SISO",eqs,t]

Use the block.

Real-time simulation

New interface to run simulations in real-time and show results in Mathematica:

WSMModelData["MathematicaExamples.Basic.InputAdd"]

conn=WSMRealTimeSimulate[,200]

Set up a control signal:

AngularGauge[Dynamic[cU],{-1,1}]

Set the input to the model:

WSMLink`Simulate`SetInputs[conn,"u"->(cU&)]

WSMRealTimePlot[conn,{"u","y"},10]

MichiganTech, DC to DC converter

Ben Gurion University–User Story

Full story: link

Electrical Engineering Blog

WSMModelData["EEBlog.Examples.Filter","Diagram"]

Simulate the filter:

simdata=WSMSimulate["EEBlog.Examples.Filter",{0,0.02},Method->{"DASSL","InterpolationPoints"->3000}];

WSMPlot[simdata,{"highFrequency.p.v","resistor.p.v"},{0,0.002},PlotPoints->80,
AxesLabel-> {"Time [s]","Potential [V]"} ,
PlotLegends->Placed[SwatchLegend[{"High frequency input signal","Lowpass filtered output signal"}],Below]]

Another way to see this is to look at the frequency spectrum of these signals. First I sample the signals:

{spoints,nsample}={512,80000};

{inputsignal,outputsignal}={Table[Evaluate@simdata["highFrequency.p.v",t],{t,0,(spoints-1)/nsample,1/nsample}],Table[Evaluate@simdata["resistor.p.v",t],{t,0,(spoints-1)/nsample,1/nsample}]};

Then I can look at their spectra by using the discrete Fourier transform:

{inspectrum,outspectrum}={Abs[Fourier[inputsignal,FourierParameters->{1,-1}]],Abs[Fourier[outputsignal,FourierParameters->{1,-1}]]};

fspaceing=Table[f//N, {f, 0, nsample (spoints-1)/(spoints),nsample/spoints}];

ListPlot[{Transpose[{fspaceing,inspectrum}],Transpose[{fspaceing,outspectrum}]},PlotLegends->Placed[SwatchLegend[{"High frequency input signal","Lowpass filtered output signal"}],Below], PlotRange->{{0,40000},{0,All}},Joined->True,PlotLabel->"Fourier spectrum",AxesLabel->{"Frequency [Hz]","Amplitude"}]

Full blog post: link

Mechanical Engineering

Upcoming blog post on the Wolfram Blog, focusing on mechanical engineering.

Simulink Model

Source: http://ctms.engin.umich.edu/CTMS/index.php?example=Suspension&section=SimulinkModeling

SystemModeler

Equivalent model created in SystemModeler:

WSMModelData["MEBlog.Examples.Suspension"]

WSMPlot[,"bodyMass.s",PlotPoints->100,PlotRange->All,AxesLabel->{"Time [s]","Position [m]"},PlotLegends->Placed["Expressions",Below]]

Fun times ahead

Thank you!

Questions & Comments